import Main from '@/view/main';
import Mains from '@/view/main/mains';
import parentView from '@/components/parent-view';

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 * }
 */

export default [
    {
        path: '/admin-view/login',
        name: 'login',
        meta: {
            title: 'Login - 登录',
            hideInMenu: true,
        },
        component: () =>
            import('@/view/login/login.vue'),
    },
    {
        path: '/admin-view/shop',
        name: 'shop',
        component: Main,
        meta: {
            access: ['shop-list'],
            title: '门店管理'
        },
        children: [{
            path: 'shop-list',
            name: 'shop-list',
            meta: {
                access: ['shop-list'],
                title: '门店信息',
                notCache: true,
            },
            component: () =>
                import('@/view/shop/list')
        }
        ]
    },
    {
        path: '/admin-view/banner',
        name: 'banner',
        component: Main,
        meta: {
            access: ['banner-list'],
            title: '轮播图管理'
        },
        children: [{
            path: 'banner-list',
            name: 'banner-list',
            meta: {
                access: ['banner-list'],
                title: '轮播列表',
                notCache: true,
            },
            component: () =>
                import('@/view/banner/bannerList')
        }
        ]
    },
    {
        path: '/admin-view/goods',
        name: 'goods',
        component: Main,
        meta: {
            access: ['good-cate-list', 'good-list'],
            title: '商品管理'
        },
        children: [
            {
                path: 'good-cate-list',
                name: 'good-cate-list',
                meta: {
                    access: ['good-cate-list'],
                    title: '商品分类',
                    notCache: true,
                },
                component: () =>
                    import('@/view/goods/categoryList')
            },
            {
                path: 'good-list',
                name: 'good-list',
                meta: {
                    access: ['good-list'],
                    title: '商品列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/goods/goodsList')
            },
        ]
    },
    {
        path: '/admin-view/customer',
        name: 'customer',
        component: Main,
        meta: {
            access: ['customer-list', 'customer-collect-list'],
            title: '客户管理'
        },
        children: [
            {
                path: 'customer-list',
                name: 'customer-list',
                meta: {
                    access: ['customer-list'],
                    title: '客户列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/customer/customerList')
            },
            {
                path: 'collect-list',
                name: 'collect-list',
                meta: {
                    access: ['customer-collect-list'],
                    title: '客户收藏列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/customer/collectList')
            },
            {
                path: 'appointment-list',
                name: 'appointment-list',
                meta: {
                    access: ['appointment-list'],
                    title: '客户预约列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/customer/appointmentList')
            },
        ]
    },
    {
        path: '/admin-view/finance',
        name: 'finance',
        component: Main,
        meta: {
            access: ['assets'],
            title: '财务管理',
        },
        children: [
            {
                path: 'assets',
                name: 'assets',
                meta: {
                    access: ['assets'],
                    title: '资产管理',
                    notCache: true,
                },
                component: () =>
                    import('@/view/finance/assets.vue'),
            },
            {
                path: 'order-list',
                name: 'order-list',
                meta: {
                    access: ['order-list'],
                    title: '订单列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/finance/orderList.vue'),
            },
            {
                path: 'refund-list',
                name: 'refund-list',
                meta: {
                    access: ['refund-list'],
                    title: '退款列表',
                    notCache: true,
                },
                component: () =>
                    import('@/view/finance/refundList.vue'),
            },
            {
                path: 'cash-record/:shop_id?',
                name: 'cash-record',
                meta: {
                    access: ['cash-record'],
                    title: '提现记录',
                    notCache: true,
                    hideInMenu: true,
                },
                component: () =>
                    import('@/view/finance/cash_record.vue'),
            }
        ],
    },
    {
        path: '/admin-view/user_manager',
        name: 'user_manager',
        meta: {
            access: ['privilege-list', 'role-list', 'user-list'],
            title: '后台用户管理',
        },
        component: Main,
        children: [{
            path: 'privilege-list',
            name: 'privilege-list',
            meta: {
                access: ['privilege-list'],
                title: '权限管理',
                //hideInMenu: true,
            },
            component: () => import('@/view/user/privilege_list'),
        },
            {
                path: 'role-list',
                name: 'role-list',
                meta: {
                    access: ['role-list'],
                    title: '角色管理',
                },
                component: () =>
                    import('@/view/user/role_list'),
            },
            {
                path: 'add-role',
                name: 'add-role',
                meta: {
                    title: '创建角色',
                    notCache: true,
                    hideInMenu: true,
                },
                component: () =>
                    import('@/view/user/add_role'),
            },
            {
                path: 'edit-role/:name',
                name: 'edit-role',
                meta: {
                    title: '编辑角色',
                    notCache: true,
                    hideInMenu: true
                },
                component: () =>
                    import('@/view/user/edit_role'),
            },
            {
                path: 'user-list',
                name: 'user-list',
                meta: {
                    access: ['user-list'],
                    title: '账号管理',
                    notCache: true,
                    type: 10,
                    is_vest: -1
                },
                component: () =>
                    import('@/view/user/list.vue'),
            },
        ],
    },
    {
        path: '/argu',
        name: 'argu',
        meta: {
            hideInMenu: true,
        },
        component: Main,
        children: [{
            path: 'params/:id',
            name: 'params',
            meta: {
                title: '动态路由',
                notCache: true,
            },
            component: () =>
                import('@/view/argu-page/params.vue'),
        },
            {
                path: 'query',
                name: 'query',
                meta: {
                    title: '带参路由',
                    notCache: true,
                },
                component: () =>
                    import('@/view/argu-page/query.vue'),
            },
        ],
    },
    {
        path: '/401',
        name: 'error_401',
        meta: {
            hideInMenu: true,
        },
        component: () =>
            import('@/view/error-page/401.vue'),
    },
    {
        path: '/500',
        name: 'error_500',
        meta: {
            hideInMenu: true,
        },
        component: () =>
            import('@/view/error-page/500.vue'),
    },
    {
        path: '*',
        name: 'error_404',
        meta: {
            hideInMenu: true,
        },
        component: () =>
            import('@/view/error-page/404.vue'),
    },
]
